<?php

namespace Luka\WindowBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Luka\NavigationBundle\Controller\NavigationController;
use Luka\WindowBundle\Controller\Helpers\MenuHelper;
use Symfony\Component\DependencyInjection\ContainerInterface;

class WindowBaseController extends NavigationController {
    public function setContainer(ContainerInterface $container = null) {
        parent::setContainer($container);
        $this->GenerateMenu();
    }

    protected function GenerateMenu(){
        $mh = new MenuHelper();
        $route = $this->get('router');
        $params = $route->match(empty($_SERVER['PATH_INFO']) ? "/" : $_SERVER['PATH_INFO']);
        $items = $mh->SetPages($this->entityManager, $this->locale, 0, $params, $route);
        $this->MenuItemAddRange($items);
        $this->MenuItemAdd("test 1");
        $this->MenuItemAdd("test 2");
        $this->MenuItemAdd("test 3");
    }
}